package cn.sccdlg.ssm.service.impl;

import cn.sccdlg.ssm.dao.IOrderDao;
import cn.sccdlg.ssm.domain.Order;
import cn.sccdlg.ssm.service.OrderService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author RaoShuang
 * @emil 991207823@qq.com
 * @date 2020/10/28 21:07
 * 订单业务层实现类
 */
@Service("orderService ")
@Transactional(rollbackFor = {Exception.class, Error.class})
public class OrderServiceImpl implements OrderService {

    @Autowired
    private IOrderDao orderDao;

    @Override
    public List<Order> findAllNonPaged() throws Exception {
        return orderDao.findAllNonPaged();
    }

    @Override
    public List<Order> findAll(int page, int size) throws Exception {
        //参数pageNum:是页码值,参数pageSize:是每页显示条数
        PageHelper.startPage(page, size);
        return orderDao.findAll();
    }

    @Override
    public Order findById(String ordersId) throws Exception {
        return orderDao.findById(ordersId);
    }
}
